﻿<UserControl x:Class="uTorrentSL.Views.FilterView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
			 xmlns:cv="clr-namespace:uTorrentSL.Converters"
             xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
             mc:Ignorable="d"
			 d:DesignWidth="500"
			 d:DesignHeight="600"
             DataContext="{Binding FilterViewModel, Source={StaticResource Locator}}">
<UserControl.Resources>
	<cv:EnumListConverter x:Key="EnumConv"/>
</UserControl.Resources>
    <Grid Grid.Row="1" Grid.Column="1" Margin="10,10,10,10">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <toolkit:DataForm CurrentItem="{Binding SelectedFilter}" AutoGenerateFields="False">
        	      <toolkit:DataForm.DataFieldStyle>
            	<Style TargetType="toolkit:DataField">
            		<Setter Property="LabelPosition" Value="Top"/>
					<Setter Property="VerticalAlignment" Value="Top"/>       	
				</Style>         
			</toolkit:DataForm.DataFieldStyle>
			<toolkit:DataForm.EditTemplate>
				<DataTemplate>
					<StackPanel>
						<Grid HorizontalAlignment="Stretch">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="78"/>
								<ColumnDefinition Width="*"/>
							</Grid.ColumnDefinitions>
							<toolkit:DataField PropertyPath="Enabled" Label="Enabled" >
								<CheckBox IsChecked="{Binding Enabled}"/>
							</toolkit:DataField>
							<toolkit:DataField PropertyPath="Name" Label="Name" Grid.Column="1">
                                <TextBox Text="{Binding Name, Mode=TwoWay}"/>
							</toolkit:DataField>						
						</Grid>
						<toolkit:DataField PropertyPath="FilterText" Label="Filter">
                            <TextBox Text="{Binding FilterText, Mode=TwoWay}"/>
							</toolkit:DataField>
							<toolkit:DataField PropertyPath="NotFilter" Label="Not">
                            <TextBox Text="{Binding NotFilter, Mode=TwoWay}"/>
							</toolkit:DataField>
							<toolkit:DataField PropertyPath="Directory" Label="Save in">
								<Grid>
									<Grid.ColumnDefinitions>
										<ColumnDefinition Width="*"/>
										<ColumnDefinition Width="Auto"/>
									</Grid.ColumnDefinitions>
                                <TextBox Text="{Binding Directory, Mode=TwoWay}"/>
									<Button Content="..." Grid.Column="1"/>
								</Grid>
							</toolkit:DataField>
							<toolkit:DataField PropertyPath="Feed" Label="Feed">
								<ComboBox ItemsSource="{Binding Path=FeedsViewModel.Data.Feeds, Source={StaticResource Locator}}"
								DisplayMemberPath="Url"
								SelectedValuePath="Ident" SelectedValue="{Binding Feed, Mode=TwoWay}" />
							</toolkit:DataField>
							<toolkit:Expander Header="Quality" Margin="3">
								<StackPanel Margin="10,3,3,3">
									<CheckBox IsChecked="{Binding Path=Quality.DSRip, Mode=TwoWay}" Content="DSRip"/>
									<CheckBox IsChecked="{Binding Path=Quality.DVBRip, Mode=TwoWay}" Content="DVBRip"/>
									<CheckBox IsChecked="{Binding Path=Quality.DVDR, Mode=TwoWay}" Content="DVDR"/>
							        <CheckBox IsChecked="{Binding Path=Quality.DVDRip, Mode=TwoWay}" Content="DVDRip"/>
							        <CheckBox IsChecked="{Binding Path=Quality.DVDScr, Mode=TwoWay}" Content="DVDScr"/>
							        <CheckBox IsChecked="{Binding Path=Quality.HDTV, Mode=TwoWay}" Content="HDTV"/>
							        <CheckBox IsChecked="{Binding Path=Quality.HRHDTV, Mode=TwoWay}" Content="HRHDTV"/>
							        <CheckBox IsChecked="{Binding Path=Quality.HRPDTV, Mode=TwoWay}" Content="HRPDTV"/>
							        <CheckBox IsChecked="{Binding Path=Quality.PDTV, Mode=TwoWay}" Content="PDTV"/>
							        <CheckBox IsChecked="{Binding Path=Quality.SatRip, Mode=TwoWay}" Content="SatRip"/>
							        <CheckBox IsChecked="{Binding Path=Quality.SVCD, Mode=TwoWay}" Content="SVCD"/>
							        <CheckBox IsChecked="{Binding Path=Quality.TVRip, Mode=TwoWay}" Content="TVRip"/>
							        <CheckBox IsChecked="{Binding Path=Quality.WebRip, Mode=TwoWay}" Content="WebRip"/>
							        <CheckBox IsChecked="{Binding Path=Quality.Seven20p, Mode=TwoWay}" Content="Seven20p"/>
							        <CheckBox IsChecked="{Binding Path=Quality.Ten80i, Mode=TwoWay}" Content="Ten80i"/>
							        <CheckBox IsChecked="{Binding Path=Quality.Ten80p, Mode=TwoWay}" Content="Ten80p"/>
								</StackPanel>
							</toolkit:Expander>
							<Grid Margin="5,5,5,5">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="30"/>
									<ColumnDefinition Width="Auto"/>
									<ColumnDefinition Width="*"/>
								</Grid.ColumnDefinitions>
								<CheckBox  IsChecked="{Binding EpisodeFilter, Mode=TwoWay}" VerticalAlignment="Center" />
								<TextBlock Text="Episode Number: [ex. 1x12-14]" Margin="0,0,10,0" Grid.Column="1" VerticalAlignment="Center"/>
								<TextBox Grid.Column="2" Text="{Binding EpisodeFilterStr, Mode=TwoWay}" VerticalAlignment="Center"/>
							</Grid>
							<Grid Margin="5,5,5,5">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="30"/>
									<ColumnDefinition Width="*"/>
								</Grid.ColumnDefinitions>
								<CheckBox  IsChecked="{Binding FilterMatchesOriginalName, Mode=TwoWay}" VerticalAlignment="Center" />
								<TextBlock Text="Filter matches original name instead of decoded name" Margin="0,0,10,0" Grid.Column="1" VerticalAlignment="Center"/>
							</Grid>
							<Grid Margin="5,5,5,5">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="30"/>
									<ColumnDefinition Width="*"/>
								</Grid.ColumnDefinitions>
								<CheckBox  IsChecked="{Binding DontStartAuto, Mode=TwoWay}" VerticalAlignment="Center" />
								<TextBlock Text="Don't start downloads automatically" Margin="0,0,10,0" Grid.Column="1" VerticalAlignment="Center"/>
							</Grid>
							<Grid Margin="5,5,5,5">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="30"/>
									<ColumnDefinition Width="Auto"/>
									<ColumnDefinition Width="30"/>
									<ColumnDefinition Width="*"/>
								</Grid.ColumnDefinitions>
								<CheckBox  IsChecked="{Binding GiveHighestPrio, Mode=TwoWay}" VerticalAlignment="Center" />
								<TextBlock Text="Give download highest priority" Margin="0,0,10,0" Grid.Column="1" VerticalAlignment="Center"/>
								<CheckBox  IsChecked="{Binding SmartEpFilter, Mode=TwoWay}" VerticalAlignment="Center" Grid.Column="2" />
								<TextBlock Text="Smart ep. filter" Margin="0,0,10,0" Grid.Column="3" HorizontalAlignment="Left" VerticalAlignment="Center"/>
							</Grid>
							<Grid Margin="5,10,5,5">
								<Grid.ColumnDefinitions>
									<ColumnDefinition />
									<ColumnDefinition />
									<ColumnDefinition />
								</Grid.ColumnDefinitions>
								<TextBlock Grid.Column="0" Text="Minimum interval" VerticalAlignment="Center"/>
                            <ComboBox Grid.Column="1" ItemsSource="{Binding PostponeMode, Converter={StaticResource EnumConv}}"
								 SelectedItem="{Binding PostponeMode}"/>
								<Button Content="Reset" Grid.Column="2"/>
							</Grid>
							<toolkit:DataField PropertyPath="Label" Label="Label">
								<TextBox Text="{Binding Label}"/>
							</toolkit:DataField>
					</StackPanel>
				</DataTemplate>
			</toolkit:DataForm.EditTemplate>
		</toolkit:DataForm>
        <Grid Grid.Row="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Button x:Name="btnSave" Content="Save" Command="{Binding SaveFilter}">
                
            </Button>
            <Button Content="Remove" Grid.Column="1" Command="{Binding RemoveFilter}"/>
        </Grid>
        <!--<Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <TextBlock VerticalAlignment="Center" Grid.Column="0" Grid.Row="0"
                           Text="Name:"/>
                <TextBox x:Name="tbName" VerticalAlignment="Center"  Grid.Column="1" Grid.Row="0"
                             Text="{Binding Name, Mode=TwoWay}"/>
                <TextBlock VerticalAlignment="Center"  Grid.Column="0" Grid.Row="1"
                           Text="Filter:"/>
                <TextBox x:Name="tbFilter" VerticalAlignment="Center"  Grid.Column="1" Grid.Row="1"
                             Text="{Binding FilterText}"/>
                

            </Grid>-->
    </Grid>
</UserControl>
